package com.erci.controller.user;


import com.erci.entity.VO.CategoryVO;
import com.erci.result.Result;
import com.erci.service.CategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


//@CrossOrigin(origins = "http://localhost:5172")
@RestController("userCategoryController")
@RequestMapping("/user/category")
@Slf4j
public class CategoryController {
    @Autowired
    private CategoryService categoryService;

    @GetMapping("/all")
    public Result<List<CategoryVO>> allCategory(){
        List<CategoryVO> list = categoryService.allCategory();
        return Result.success(list);
    }

    @GetMapping("/names")
    public Result<List<String>> allCategoryNames(@RequestParam("ids") List<String> ids){

        List<String> list = categoryService.allCategoryNames(ids);
        return Result.success(list);
    }

}
